package com.huntech.common.domain;

import lombok.Data;

@Data
public class Response<T> {

    private int code; //状态码

    private String message; //消息

    private T data; //返回数据

    private Response(int code, T data, String message){
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public static <T> Response<T> ok(T data, String message){
        return new Response<>(200, data, message);
    }

    public static <T> Response<T> error(String message){
        return new Response<>(400, null, message);
    }
}

